<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('AI管理')"/>
    <!--    <th:block th:include="include :: select2-css"/>-->
    <!--    <th:block th:include="include :: bootstrap-select-css"/>-->
</head>
<style>
    .select2-container--bootstrap .select2-results__group {
        color: rgb(119, 119, 119);
        display: block;
        font-size: 20px;
        line-height: 1.42857;
        white-space: nowrap;
        padding: 6px 12px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeIn">
    <div class="row">
        <div class="col-sm-12">
            <div class="tabs-container">
                <ul class="nav nav-tabs">
                    <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">创建AI</a>
                    </li>
                    <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">AI控制</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <!--                                                                                                -->
                    <div id="tab-1" class="tab-pane active">
                        <div class="panel-body">
                            <strong>AI创建</strong>
                            <div class="ibox-content">
                                <form class="form-horizontal" id="form_ai">
                                    <div class="form-group">
                                        <label class="col-sm-1 control-label">AI类型：</label>
                                        <div class="col-sm-3">
                                            <select class="form-control" name="level" id="EquipmentLevel">
                                                <option value="0">新手AI</option>
                                                <option value="70">70级</option>
                                                <option value="80">80级</option>
                                                <option value="90">90级</option>
                                                <option value="100">100级</option>
                                                <option value="110">110级</option>
                                                <option value="120">120级</option>
                                                <option value="130">130级</option>
                                                <option value="140">140级</option>
                                                <option value="150">150级</option>
                                                <option value="160">160级</option>
                                                <option value="170">170级</option>

                                            </select>
                                        </div>
                                        <label class="col-sm-1 control-label">AI数量：</label>
                                        <div class="col-sm-3">
                                            <input type="nunmber" class="form-control"  value = 0 name="aiNum">
                                        </div>

                                        <div class="col-sm-4">
                                            <button class="btn btn-sm btn-white" type="button" onclick="create_ai()">立即创建</button>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-1 control-label">AI类型：</label>
                                        <div class="col-sm-3">
                                            <select class="form-control" name="loginType" id="EquipmentLevel2">
                                                <option value="0">新手AI</option>
                                                <option value="1">战斗AI</option>
                                            </select>
                                        </div>
                                        <label class="col-sm-1 control-label">操作：</label>
                                        <div class="col-sm-3">
                                            <button class="btn btn-sm btn-white" type="button" onclick="send_Login()">一键登录</button>
                                            <button class="btn btn-sm btn-white" type="button" onclick="send_Close()">一键退出</button>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-3">
                                            <button class="btn btn-sm btn-white" type="button" onclick="send_MoveTask()">新手AI移动</button>
                                            <button class="btn btn-sm btn-white" type="button" onclick="send_StopTask()">停止移动</button>
                                            <button class="btn btn-sm btn-white" type="button" onclick="send_MoveFight()">战斗AI移动</button>
                                            <button class="btn btn-sm btn-white" type="button" onclick="send_StopFight()">停止移动</button>
                                            <button class="btn btn-sm btn-white" type="button" onclick="send_Clear()">清除AI</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <!--                                                                                                -->
                    <div id="tab-2" class="tab-pane">
                        <div class="panel-body">
                            <strong>AI控制</strong>
                            <div class="ibox-content">
                                <form class="form-horizontal" id="form_ai_join">
                                    <div class="form-group">
                                        <label class="col-sm-1 control-label">关键字进组(多个'|'分隔)</label>
                                        <div class="col-sm-5">
                                            <input type="text" name="stringKey" id = "stringKey" placeholder="多个'|'分隔" class="form-control">
                                        </div>
                                        <div class="col-sm-6">
                                            <button class="btn btn-sm btn-white" type="button" onclick="send_join()">立即保存</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>

            </div>

        </div>

    </div>

</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: send-js"/>

<th:block th:include="include :: bootstrap-select-js"/>
<th:block th:include="include :: bootstrap-fileinput-css" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<script src="../static/ruoyi/js/sm-ui.js" th:src="@{/ruoyi/js/sm-ui.js?v=4.2.0}"></script>
<script type="text/javascript">

    var guanjianciUrl = ctx + "/system/accountrole/findgjc"

    var guanjianciConfig = {
        url: guanjianciUrl,
        type: "post",
        dataType: "json",
        success: function(result) {

            var obj = document.getElementById("stringKey");      //根据dom的id属性返回dom对象
            obj.value = result.data.content;
        }
    };
    $.ajax(guanjianciConfig)


    var prefix = ctx + "system/ai"
    function create_ai() {
        $.operate.saveSend(prefix + "/createAi", $('#form_ai').serialize());
    }
     function send_Login() {
        $.operate.saveSend(prefix + "/loginAi", $('#form_ai').serialize());
    }
     function send_Close() {
        $.operate.saveSend(prefix + "/closeAi", $('#form_ai').serialize());
    }
     function send_MoveTask() {
        $.operate.saveSend(prefix + "/moveTaskAi", $('#form_ai').serialize());
    }
     function send_MoveFight() {
        $.operate.saveSend(prefix + "/moveFightAi", $('#form_ai').serialize());
    }
     function send_StopTask() {
        $.operate.saveSend(prefix + "/stopTaskAi", $('#form_ai').serialize());
    }
     function send_StopFight() {
        $.operate.saveSend(prefix + "/stopFightAi", $('#form_ai').serialize());
    }



     function send_Clear() {
        $.operate.saveSend(prefix + "/ClearAi", $('#form_ai').serialize());
    }
     function send_join() {
        $.operate.saveSend(prefix + "/joinAi", $('#form_ai_join').serialize());
    }


</script>
</body>
</html>
